var a = getApp();

Page({
    data: {
        showBox: !1,
        dataInfo: {},
        listHeight: 0,
        recordsList: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(a) {},
    onShow: function() {
        this.getData();
    },
    getData: function() {
        this.setData({
            page: 1
        });
        var t = this, e = a.getNetAddresss("plugin.yun-sign.frontend.contract-num-log.get-list");
        a._getNetWork({
            url: e,
            data: {
                page: 1
            },
            success: function(e) {
                if (1 === e.data.result) {
                    var o = e.data;
                    t.setData({
                        isLoadMore: !0,
                        dataInfo: o.data,
                        recordsList: o.data.list.data,
                        total_page: o.data.list.last_page
                    }), t.data.total_page || t.setData({
                        total_page: 0
                    });
                } else a.tips(e.data.msg);
            },
            fail: function(a) {
                console.log(a, "-----fail");
            }
        });
    },
    getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore) if (this.data.page >= this.data.total_page) this.setData({
            isLoadMore: !1
        }); else {
            this.setData({
                page: this.data.page + 1
            });
            var e = a.getNetAddresss("plugin.yun-sign.frontend.contract-num-log.get-list");
            wx.showLoading({
                title: "加载中",
                mask: !0
            }), a._getNetWork({
                url: e,
                data: {
                    page: t.data.page
                },
                success: function(a) {
                    if (wx.hideLoading(), console.log(a), 1 === a.data.result) {
                        var e = a.data.data.data, o = t.data.recordsList.concat(e);
                        t.setData({
                            isLoadMore: !0,
                            recordsList: o
                        });
                    } else t.setData({
                        page: t.data.page - 1,
                        isLoadMore: !1
                    });
                },
                fail: function(a) {
                    console.log(a, "-------失败 -----------"), t.setData({
                        isLoadMore: !0
                    }), wx.hideLoading();
                }
            });
        } else a.tips("没有更多了");
    },
    handleShowBox: function() {
        this.setData({
            showBox: !this.data.showBox
        });
    },
    toSignIndex: function() {
        wx.redirectTo({
            url: "/packageH/signPage/signIndex/signIndex"
        });
    },
    onHide: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreData() : console.log("没有更多数据");
    }
});